﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QLLUONG.DTO;
using QLLUONG.DAL;
namespace QLLUONG.BLL
{
    class UserBLL
    {
        DataClasses1DataContext DB = new DataClasses1DataContext();
        public bool Insert(User US)
        {

            USER User = new USER();

            try
            {
                User.admin = US.Admin;
                User.Pass = US.Pass;
                User.Username = US.Username;
                DB.USERs.InsertOnSubmit(User);
                DB.SubmitChanges();
                return true;
            }
            catch
            {
                return false;
            }
        }
        public bool Kiemtra(String Name, String Pass)
        {
            var kh = from kt in DB.USERs
                     where kt.Username == Name && kt.Pass == Pass
                     select kt;
            if (kh.Any())
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
